package com.example.start;

import com.google.protobuf.InvalidProtocolBufferException;

public class FastStart {
    public static void main(String[] args) throws InvalidProtocolBufferException {
        PeopleInfo p1 = PeopleInfo.newBuilder()
                .setName("张三")
                .setAge(10)
                .build();
        //序列化:
        byte[] byteArray = p1.toByteArray();
        System.out.println("序列化结果: "+byteArray);
        //反序列化:
        PeopleInfo p2 = PeopleInfo.parseFrom(byteArray);
        System.out.println("反序列化结果: ");
        System.out.println("name: "+p2.getName() );
        System.out.println("age: "+p2.getAge());

    }
}
